﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http.Filters;
using ELGGAPI.Data;

namespace ELGGAPI.Models
{
    public class Response<T>
    {
        public T Data { get; set; }
        public string Message { get; set; }
    }
    public class Request<T>
    {
        public T Data { get; set; }
        public string access_token { get; set; }
    }

    public class User
    {
        public int UserId { get; set; }
        public int Name { get; set; }
        public int DisplayName { get; set; }
    }
    public class Idclass
    {
        public int id { get; set; }
    }
    public class Textclass
    {
        public string text { get; set; }
    }

    public class GUIDclass
    {
        public string guid { get; set; }
    }
    public static class Authenticate
    {
        public static User AuthenticateByToken(string token)
        {
            if (String.IsNullOrEmpty(token))
            {
                return null;
            }


            return new User { UserId = 1 };
        }
        //private User AuthenticateUser()


    }


    public static class APIHelper
    {
        public static string ConnectionString
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["ConELGG"].ConnectionString;
            }
        }
        public static string DBName
        {
            get
            {
                string str = ConfigurationManager.AppSettings["DBName"].ToString();
                if (str.Length > 0)
                    return str + ".";
                else
                    return "";
            }
        }
        public static string SecretToken
        {
            get
            {
                return ConfigurationManager.AppSettings["SecretToken"].ToString();
            }
        }
        public static int Ticks
        {
            get
            {
                int ticks;

                if (!int.TryParse(ConfigurationManager.AppSettings["Ticks"], out ticks))
                {
                    return 0;
                }
                return ticks;
            }
        }
    }

    //public class CustomExceptionFilter : ExceptionFilterAttribute
    //{
    //    public override void OnException(HttpActionExecutedContext context)
    //    {


    //    }
    //}
}